﻿<%@ Control Language="C#" AutoEventWireup="true" CodeFile="PurchaseOrderCreate.ascx.cs" Inherits="Admin_Components_PurchaseOrder_PurchaseOrderCreate" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %>
<telerik:RadScriptManager ID="ScriptManager2" runat="server" EnableTheming="True"></telerik:RadScriptManager>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
    <ContentTemplate>
        
        <telerik:radformdecorator id="QsfFromDecorator" runat="server" decoratedcontrols="All"
            enableroundedcorners="false" />
        <telerik:RadTabStrip ID="TabStrip1" runat="server" EnableDragToReorder="true" Skin="Vista" MultiPageID="RadMultiPag1" SelectedIndex="1">
            <Tabs>
                <telerik:RadTab Text="TẠO MỚI" Selected="True">
                </telerik:RadTab>
                <telerik:RadTab Text="TÌM KIẾM"></telerik:RadTab>
            </Tabs>
        </telerik:RadTabStrip>
        <telerik:RadMultiPage ID="RadMultiPag1" runat="server" SelectedIndex="0">
            <!--Tab thông tin chung -->
            <telerik:RadPageView ID="RadPageView1" runat="server"  Style="overflow: hidden">
                 <fieldset class="form" id="fsGeneral">
                  <br />
                <div class="form-horizontal wrapper-center clearfix">
                <!--Block bên trái -->
                 <div class="form-group col-md-6">
                     <!--Dòng -->
                    <div class="form-group">
                        <label class="col-md-3 control-label">
                            Mã đơn nhập hàng</label>
                        <div class="col-md-7">
                            <telerik:RadTextBox ID="txtPurchaseOrderCode" CssClass="col-imp-8 inputForm" Width="40px" runat="server" readOnly= "true" />
                        </div>
                    </div>
                  <!--End Dòng -->
                 <!--Dòng -->
                <div class="form-group">
                    <label class="col-md-3 control-label">Tỉnh/thành phố<span style="color:red;">(*)</span></label>
                    <div class="col-md-7">
                        <telerik:RadComboBox ID="cbProvince" runat="server" CssClass="col-imp-8" TabIndex="1" Width="70px" AllowCustomText="false"   AutoPostBack="true" OnSelectedIndexChanged="cbProvince_SelectedIndexChanged"  />
                        <asp:RequiredFieldValidator  ID="RequiredFieldValidator5" runat="server" ControlToValidate="cbProvince" ValidationGroup="g1"
                           ErrorMessage="Required(*)" InitialValue=""></asp:RequiredFieldValidator>
                     </div>
                </div>
                <!--End Dòng -->
                <!--Dòng -->
                <div class="form-group">
                    <label class="col-md-3 control-label">Cửa hàng<span style="color:red;">(*)</span></label>
                    <div class="col-md-7">
                        <telerik:RadComboBox ID="cbShop" runat="server" CssClass="col-imp-8" TabIndex="1" Width="70px" AllowCustomText="false"   />
                        <asp:RequiredFieldValidator  ID="RequiredFieldValidator1" runat="server" ControlToValidate="cbShop" ValidationGroup="g1"
                           ErrorMessage="Required(*)" InitialValue=""></asp:RequiredFieldValidator>
                     </div>
                </div>
                <!--End Dòng -->
                <!--Dòng -->
                <div class="form-group">
                    <label class="col-md-3 control-label">Thuộc loại<span style="color:red;">(*)</span></label>
                    <div class="col-md-7">
                        <telerik:RadComboBox ID="cbType" runat="server" CssClass="col-imp-5" AllowCustomText="false" EmptyMessage="---Chọn---" filter="Contains" AutoPostBack="true" OnSelectedIndexChanged="cbType_SelectedIndexChanged" >
                                <Items>
                                    <telerik:RadComboBoxItem Text="Gạo" Value="R" />
                                    <telerik:RadComboBoxItem Text="Quà tặng" Value="P" />
                                </Items>
                            </telerik:RadComboBox>
                     </div>
                </div>
                <!--End Dòng -->
                <!--Dòng -->
                <div class="form-group">
                    <label class="col-md-3 control-label">
                        Ghi chú</label>
                    <div class="col-md-7">
                        <telerik:RadTextBox ID="txtRemark" CssClass="col-imp-12 inputForm" Width="100px" runat="server" MaxLength="1500"   TextMode="MultiLine" Resize="Both"/>
                    </div>
                </div>
                <!--End Dòng -->
                     
                </div>
                 <!--End Block bên trái -->
                 <!--Block bên phải -->
                <div class="form-group col-md-6">
                    <!--Dòng -->
                    <div class="form-group">
                        <label class="col-md-3 control-label">Ngày nhập<span style="color:red;">(*)</span></label>
                        <div class="col-md-8">
                            <telerik:RadDatePicker ID="rdpPurchaseDate" runat="server" Width="140px"   
                        MinDate="01/01/1000" MaxDate="01/01/3000">
                        <Calendar>
                            <SpecialDays>
                                <telerik:RadCalendarDay Repeatable="Today" ItemStyle-CssClass="rcToday">
                                </telerik:RadCalendarDay>
                            </SpecialDays>
                        </Calendar>
                        <DateInput id="txtPurchaseDate"  style="width:200px" DisplayDateFormat="dd/MM/yyyy" DateFormat="dd/MM/yyyy" readOnly="true"></DateInput>
                                
                </telerik:RadDatePicker>
                            <asp:RequiredFieldValidator ID="PickerRequiredFieldValidator" runat="server" Display="Dynamic" ValidationGroup="g1"
                            ControlToValidate="rdpPurchaseDate" ErrorMessage="Required(*)"></asp:RequiredFieldValidator>
                         </div>
                    </div>
                    <!--End Dòng -->
                    <!--Dòng -->
                     <div class="form-group">
                        <label class="col-md-3 control-label">Nhà cung cấp</label>
                        <div class="col-md-8">
                           <telerik:RadComboBox ID="cbVendor" runat="server" CssClass="col-imp-8" TabIndex="1" Width="70px" AllowCustomText="false"  EmptyMessage="Nhập mã NCC hoặc tên NCC" filter="Contains"/>
                         </div>
                    </div>
                    <!--End Dòng -->
                    <!--Dòng -->
                     <div class="form-group">
                        <label class="col-md-3 control-label">Người cập nhật</label>
                        <div class="col-md-8">
                           <telerik:RadTextBox ID="txtLastUpdatedBy" CssClass="col-imp-4 inputForm" Width="40px" runat="server" Enabled ="false"/>
                         </div>
                    </div>
                    <!--End Dòng -->
                    <!--Dòng -->
                     <div class="form-group">
                        <label class="col-md-3 control-label">Ngày cập nhật</label>
                        <div class="col-md-8">
                           <telerik:RadTextBox ID="txtLastUpdatedDateTime" CssClass="col-imp-4 inputForm" Width="40px" runat="server" Enabled ="false" />
                         </div>
                    </div>
                    <!--End Dòng -->
                    <!--Dòng -->
                     <div class="form-group">
                        <label class="col-md-3 control-label">Tình trạng</label>
                        <div class="col-md-8">
                           <telerik:RadTextBox ID="txtStatus" CssClass="col-imp-4 inputForm" Width="40px" runat="server" Enabled ="false" />
                         </div>
                    </div>
                    <!--End Dòng -->
                </div>
                 <!--End Block bên phải -->
            </div>
            </fieldset>
            <!--Action-->
                <div id="divStamp" runat="server"  visible="false"><asp:Label ID="lblStamRemain" runat="server" Text=""></asp:Label></div>
            <div class="set-btns text-center">
                <asp:Button ID="btnSave" CssClass="btn btn-sm btn-primary" runat="server" Text="Lưu" OnClick="btnSave_Click"  ValidationGroup="g1" />
                <asp:Button ID="btnInput" CssClass="btn btn-sm btn-primary" runat="server" Text="Nhập kho" OnClientClick="return ConfirmOnDelete('Bạn chắc chắn muốn nhập kho?')"  OnClick="btnInput_Click"    />
                <asp:Button ID="btnCancel" runat="server" CssClass="btn btn-sm btn-warning" Text="Xóa"  OnClientClick="return ConfirmOnDelete('Bạn chắc chắn muốn xóa?')"  OnClick="btnCancel_Click"/>
                <asp:Button ID="btnNew" CssClass="btn btn-sm btn-primary" runat="server" Text="Tạo mới" OnClick="btnNew_Click" />
            </div>
            <!--End Action -->
             <div class="form-group text-left">
            
                <telerik:RadComboBox ID="cbProduct" runat="server" CssClass="col-imp-3" EmptyMessage="Nhập mã sản phẩm hoặc tên sản phẩm" filter="Contains">
                </telerik:RadComboBox><span style="color:red;">(*)</span><asp:RequiredFieldValidator  ID="RequiredFieldValidator4" runat="server" ControlToValidate="cbProduct" ValidationGroup="g2"
                           ErrorMessage="Required(*)" InitialValue=""></asp:RequiredFieldValidator>
                <telerik:RadTextBox ID="txtQuantity" CssClass="col-imp-1 inputForm"   EmptyMessage="Nhập số lượng"  runat="server" onkeyup = "FormatNumber(this)"  /><span style="color:red;">(*)</span>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" Display="Dynamic" ValidationGroup="g2"
                            ControlToValidate="txtQuantity" ErrorMessage="Required(*)"></asp:RequiredFieldValidator>
                <telerik:RadTextBox ID="txtPurchasePrice" CssClass="col-imp-1 inputForm"  EmptyMessage="Nhập giá"  runat="server" onkeyup = "FormatNumber(this)" ></telerik:RadTextBox><span style="color:red;">(*)</span>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" Display="Dynamic" ValidationGroup="g2"
                            ControlToValidate="txtPurchasePrice" ErrorMessage="Required(*)"></asp:RequiredFieldValidator>
                <asp:Button ID="btnAdd" runat="server" CssClass="btn btn-sm btn-primary"  ValidationGroup="g2" Text="Thêm" OnClick="btnAdd_Click"/>
                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                <input type="file" id="fuImport" runat="server" CssClass="col-imp-2 inputForm"  ValidationGroup="gImport"/><span style="color:red;">(*)</span>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator6" runat="server" Display="Dynamic" ValidationGroup="gImport"
                            ControlToValidate="fuImport" ErrorMessage="Required(*)"></asp:RequiredFieldValidator>            
                <asp:Button ID="btnImport" CssClass="btn btn-sm btn-primary" runat="server" Text="Import excel" ValidationGroup="gImport" OnClick="btnImport_Click"   />&nbsp;&nbsp;
                 <a style="color: Blue;" href='Admin/Template/mau_import_san_pham.xlsx' target='_blank'>Download Mẫu Excel</a>
             
             </div>
            <!--Grid data-->
            <div class="row">
            <div style="float: left;font-weight:bold" runat="server" id="div_TotalProduct" >&nbsp;Tổng cộng sản phẩm: 0</div>
            <telerik:radgrid id="gvProduct" runat="server" cellspacing="0" cssclass=" table table-bordered"
                gridlines="None" autogeneratecolumns="False" Height="200" headerstyle-horizontalalign="Center" OnItemCommand="gvProduct_ItemCommand" 
                allowmultirowselection="True" headerstyle-borderstyle="None">
                <ClientSettings>
                <Scrolling AllowScroll="True" UseStaticHeaders="True" SaveScrollPosition="true" FrozenColumnsCount="2"></Scrolling>
            </ClientSettings>
                <MasterTableView ShowHeader="true" NoMasterRecordsText="Không có dữ liệu." ShowGroupFooter="true">
                <Columns>
                    <telerik:GridTemplateColumn HeaderText="STT" HeaderButtonType="TextButton" ItemStyle-HorizontalAlign="Center">
                        <ItemTemplate>
                            <%# Container.ItemIndex + 1 %></ItemTemplate>
                        <HeaderStyle Width="50px" />
                        <ItemStyle HorizontalAlign="Center" />
                    </telerik:GridTemplateColumn>
                    <telerik:GridBoundColumn DataField="ProductID" HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center"
                                 UniqueName="ProductID" Display="false">
                                <HeaderStyle HorizontalAlign="Center"></HeaderStyle>
                                <ItemStyle HorizontalAlign="Center"></ItemStyle>
                    </telerik:GridBoundColumn>
                     <telerik:GridBoundColumn  DataField="ProductName" UniqueName="ProductName"  ReadOnly="true" HeaderText="Tên sản phẩm">
                        <HeaderStyle HorizontalAlign="Center" />
                        <ItemStyle HorizontalAlign="Left" Font-Bold ="true"/>
                    </telerik:GridBoundColumn>
                    <telerik:GridTemplateColumn HeaderText="Số lượng" UniqueName="Quantity" DataField="Quantity">
                            <ItemTemplate>
                                <asp:Label ID="lblQuantity" runat="server" Text='<%# String.Format("{0:#,#.##}", float.Parse(Eval("Quantity").ToString() == "" ? "0" : Eval("Quantity").ToString()))%>'></asp:Label>
                            </ItemTemplate>
                            <HeaderStyle HorizontalAlign="Center" Width="180px" />
                            <ItemStyle HorizontalAlign="Right" Width="180px" />
                    </telerik:GridTemplateColumn>
                    <telerik:GridTemplateColumn HeaderText="Trọng lượng(Kg)" UniqueName="Weight" DataField="Weight">
                            <ItemTemplate>
                                <asp:Label ID="lblWeight" runat="server" Text='<%# String.Format("{0:#,#.##}", float.Parse(Eval("Weight").ToString() == "" ? "0" : Eval("Weight").ToString()))%>'></asp:Label>
                            </ItemTemplate>
                            <HeaderStyle HorizontalAlign="Center" Width="180px" />
                            <ItemStyle HorizontalAlign="Right" Width="180px" />
                    </telerik:GridTemplateColumn>
                     <telerik:GridTemplateColumn HeaderText="Giá nhập(VNĐ)" UniqueName="PurchasePrice" DataField="PurchasePrice">
                            <ItemTemplate>
                                <asp:Label ID="lblPurchasePrice" runat="server" Text='<%# String.Format("{0:#,#.##}", float.Parse(Eval("PurchasePrice").ToString() == "" ? "0" : Eval("PurchasePrice").ToString()))%>'></asp:Label>
                            </ItemTemplate>
                            <HeaderStyle HorizontalAlign="Center" Width="180px" />
                            <ItemStyle HorizontalAlign="Right" Width="180px" />
                    </telerik:GridTemplateColumn>
                    
                    <telerik:GridTemplateColumn HeaderText="Thành tiền(VNĐ)" UniqueName="Amount" DataField="Amount">
                            <ItemTemplate>
                                <asp:Label ID="lblAmount" runat="server" Text='<%# String.Format("{0:#,#.##}", float.Parse(Eval("Amount").ToString() == "" ? "0" : Eval("Amount").ToString()))%>'></asp:Label>
                            </ItemTemplate>
                            <HeaderStyle HorizontalAlign="Center" Width="180px" />
                            <ItemStyle HorizontalAlign="Right" Width="180px" Font-Bold ="true"/>
                    </telerik:GridTemplateColumn>
                    <telerik:GridTemplateColumn HeaderText="Cập nhật" HeaderButtonType="TextButton" ItemStyle-HorizontalAlign="Center">
                        <ItemTemplate>
                            <asp:Button ID="btnEdit" CssClass="btnDelete" CommandArgument='<%# Eval("ProductID") %>'
                                CommandName="EditItem" runat="server"></asp:Button>
                        </ItemTemplate>
                        <HeaderStyle HorizontalAlign="Center" Width="100px" />
                        <ItemStyle HorizontalAlign="Center" Width="100px"></ItemStyle>
                    </telerik:GridTemplateColumn>
                    <telerik:GridTemplateColumn HeaderText="Xóa" Visible=true HeaderButtonType="TextButton" ItemStyle-HorizontalAlign="Center">
                        <ItemTemplate>
                            <asp:Button ID="btnDelete" CssClass="btnX" CommandArgument='<%# Eval("ProductID") %>'
                                OnClientClick="return ConfirmOnDelete('Bạn chắc chắn muốn xóa sản phẩm?')" CommandName="DeleteItem"
                                runat="server"></asp:Button>
                        </ItemTemplate>
                        <HeaderStyle Width="30px"/>
                            <ItemStyle HorizontalAlign="Center" />
                    </telerik:GridTemplateColumn>
                </Columns>
                </MasterTableView>
            </telerik:radgrid>
        <div id="divTotalQuantity" runat="server" class="sum-total" style="width: 310px; float: right; font-weight: bold;font-size:13pt;">Tổng số lượng: 0</div>
        <div style="clear:both"></div>
        <div id="divTotalWeight" runat="server" class="sum-total" style="width: 310px; float: right; font-weight: bold;font-size:13pt;">Tổng trọng lượng: 0 Kg</div>
        <div style="clear:both"></div>
        <div id="divTotalAmount" runat="server" class="sum-total" style="width: 310px; float: right; font-weight: bold;font-size:13pt;">Tổng tiền: 0 VNĐ</div>
        <div style="clear:both"></div>
        <div id="divGetTotalQuantity" runat="server" class="sum-total" style="display:none;"></div>
        <div style="clear:both"></div>
        <div id="divGetTotalAmount" runat="server" class="sum-total" style="display:none;"></div>
        </div>
            <!--End Grid data-->
            </telerik:RadPageView>
            <!--End Tab thông tin chung -->
            <!--Tim kiem -->
    <telerik:RadPageView ID="RadPageView3" runat="server"  Style="overflow: hidden">
                 <fieldset class="form" id="Fieldset2">
                  <br />
                <div class="form-horizontal wrapper-center clearfix">
                    <!--Block bên trái -->
                 <div class="form-group col-md-6">
                      <!--Dòng -->
                    <div class="form-group">
                        <label class="col-md-3 control-label">
                            Mã đơn nhập hàng</label>
                        <div class="col-md-8">
                            <telerik:RadTextBox ID="txtPurchaseCodeSearch" CssClass="col-imp-8 inputForm" Width="40px" runat="server"  />
                        </div>
                    </div>
                  <!--End Dòng -->
                     <!--Dòng -->
                <div class="form-group">
                    <label class="col-md-3 control-label">Tỉnh/thành phố</label>
                    <div class="col-md-8">
                        <telerik:RadComboBox ID="cbProvinceSearch" runat="server" CssClass="col-imp-8" TabIndex="1" Width="70px" AllowCustomText="false"   AutoPostBack="true" OnSelectedIndexChanged="cbProvince_SelectedIndexChanged"  />
                        
                     </div>
                </div>
                <!--End Dòng -->
                  <!--Dòng -->
                    <div class="form-group">
                        <label class="col-md-3 control-label">
                            Tên cửa hàng</label>
                        <div class="col-md-8">
                            <telerik:RadComboBox ID="cbShopSearch" runat="server" CssClass="col-imp-8" TabIndex="1" Width="70px" AllowCustomText="false"  />
                        </div>
                    </div>
                  <!--End Dòng -->
                     <!--Dòng -->
                    <div class="form-group">
                        <label class="col-md-3 control-label">
                            Thuộc loại</label>
                        <div class="col-md-7">
                            
                            <telerik:RadComboBox ID="cbTypeSearch" runat="server" CssClass="col-imp-5" AllowCustomText="false"  >
                                <Items>
                                    <telerik:RadComboBoxItem Text="---Tất cả---" Value="" />
                                    <telerik:RadComboBoxItem Text="Gạo" Value="R" />
                                    <telerik:RadComboBoxItem Text="Quà tặng" Value="P" />
                                </Items>
                            </telerik:RadComboBox>
                        </div>
                    </div>
                  <!--End Dòng -->
                </div>
                 <!--End Block bên trái -->
                     <!--Block bên phải -->
                <div class="form-group col-md-6">
                    <!--Dòng -->
                    <div class="form-group">
                        <label class="col-md-3 control-label">Từ ngày</label>
                        <div class="col-md-8">
                          <telerik:RadDatePicker ID="rtpFromDateSearch" cssclass="col-imp-8" enabled="true" runat="server" Culture="en-GB"  DateFormat="dd/MM/yyyy" readOnly ="true">
                                <Calendar ID="Calendar3" runat="server" EnableKeyboardNavigation="true" ViewSelectorText="x" Skin="Hay" UseRowHeadersAsSelectors="False" UseColumnHeadersAsSelectors="False">
                                </Calendar>
                                <DateInput  style="width:200px" DisplayDateFormat="dd/MM/yyyy" DateFormat="dd/MM/yyyy"  readOnly ="true"></DateInput>
                            </telerik:RadDatePicker>
                         </div>
                    </div>
                    <!--End Dòng -->
                    <!--Dòng -->
                    <div class="form-group">
                        <label class="col-md-3 control-label">Đến ngày</label>
                        <div class="col-md-8">
                            <telerik:RadDatePicker ID="rtpToDateSearch" cssclass="col-imp-8" enabled="true" runat="server" Culture="en-GB" DateFormat="dd/MM/yyyy" readOnly ="true">
                                <Calendar ID="Calendar4" runat="server" EnableKeyboardNavigation="true" ViewSelectorText="x" Skin="Hay" UseRowHeadersAsSelectors="False" UseColumnHeadersAsSelectors="False">
                                </Calendar>
                                <DateInput  style="width:200px" DisplayDateFormat="dd/MM/yyyy" DateFormat="dd/MM/yyyy"  readOnly ="true"></DateInput>
                            </telerik:RadDatePicker>
                         </div>
                    </div>
                    <!--End Dòng -->
                    <!--Dòng -->
                    <div class="form-group">
                        <label class="col-md-3 control-label">
                            Tình trạng</label>
                        <div class="col-md-7">
                            <telerik:RadComboBox ID="cbStatusSearch" runat="server" CssClass="col-imp-5" AllowCustomText="false" >
                                <Items>
                                    <telerik:RadComboBoxItem Text="---Tất cả---" Value="" />
                                    <telerik:RadComboBoxItem Text="Tạo mới" Value="N" />
                                    <telerik:RadComboBoxItem Text="Đã nhập hàng" Value="C" />
                                    
                                </Items>
                            </telerik:RadComboBox>
                        </div>
                    </div>
                  <!--End Dòng -->
                </div>
                 <!--End Block bên phải -->
                </div>
                <!--Button Tim Kiem-->
                 <div class="set-btns text-center">
                     <asp:Button ID="btnSearch" CssClass="btn btn-sm btn-primary" runat="server" OnClick="btnSearch_Click" Text="Tìm kiếm"  />
                </div> 
                <!--End Button Tim Kiem--> 
                    
                </fieldset>
        <br />
        <!--Grid data-->
            <div class="row">
                <div style="float: left;font-weight:bold" runat="server" id="div_TotalRows" >&nbsp;Kết quả tìm kiếm: 0</div>
                <div style="float: right;"><asp:Button ID="btnRefresh" CssClass="btnRefresh" ToolTip="Refresh" runat="server" OnClick="btnRefresh_Click" Text="Refresh"  /></div> 
            <telerik:radgrid id="gvData" runat="server" cellspacing="0" cssclass=" table table-bordered"
                gridlines="None" autogeneratecolumns="False" headerstyle-horizontalalign="Center" PageSize="10" AllowCustomPaging="true"
                allowmultirowselection="True" headerstyle-borderstyle="None" Height="250" ShowHeader="true" OnNeedDataSource="gvData_NeedDataSource"  OnItemCommand="gvData_ItemCommand">
                
                <MasterTableView ShowHeader="true" NoMasterRecordsText="Không có dữ liệu." ShowGroupFooter="true" AllowPaging="True" PageSize="10" EditMode="InPlace">
                <RowIndicatorColumn FilterControlAltText="Filter RowIndicator column"></RowIndicatorColumn>
                 <ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column"></ExpandCollapseColumn>
                <Columns>
                    <telerik:GridTemplateColumn HeaderText="STT" HeaderButtonType="TextButton" ItemStyle-HorizontalAlign="Center">
                        <ItemTemplate>
                            <%# Eval("RowID") %></ItemTemplate>
                        <HeaderStyle Width="30px" />
                        <ItemStyle HorizontalAlign="Center" />
                    </telerik:GridTemplateColumn>
                    <telerik:GridBoundColumn  DataField="PurchaseOrderCode" UniqueName="PurchaseOrderCode"  ReadOnly="true" HeaderText="Mã đơn nhập hàng">
                        <HeaderStyle HorizontalAlign="Center"  Width="100px" />
                        <ItemStyle HorizontalAlign="Left" />
                    </telerik:GridBoundColumn>
                     <telerik:GridBoundColumn  DataField="ShopName" UniqueName="ShopName"  ReadOnly="true" HeaderText="Cửa hàng">
                        <HeaderStyle HorizontalAlign="Center"  Width="100px" />
                        <ItemStyle HorizontalAlign="Left" />
                    </telerik:GridBoundColumn>
                    <telerik:GridTemplateColumn HeaderText="Tổng số lượng" UniqueName="TotalQuantity" DataField="TotalQuantity">
                            <ItemTemplate>
                                <asp:Label ID="Label3" runat="server" Text='<%# String.Format("{0:#,#.##}", float.Parse(Eval("TotalQuantity").ToString() == "" ? "0" : Eval("TotalQuantity").ToString()))%>'></asp:Label>
                            </ItemTemplate>
                            <HeaderStyle HorizontalAlign="Center" Width="180px" />
                            <ItemStyle HorizontalAlign="Right" Width="180px" />
                    </telerik:GridTemplateColumn>
                    
                    <telerik:GridTemplateColumn HeaderText="Thành tiền(VNĐ)" UniqueName="Amount" DataField="Amount">
                            <ItemTemplate>
                                <asp:Label ID="Label2" runat="server" Text='<%# String.Format("{0:#,#.##}", float.Parse(Eval("TotalAmount").ToString() == "" ? "0" : Eval("TotalAmount").ToString()))%>'></asp:Label>
                            </ItemTemplate>
                            <HeaderStyle HorizontalAlign="Center" Width="180px" />
                            <ItemStyle HorizontalAlign="Right" Width="180px" Font-Bold ="true"/>
                    </telerik:GridTemplateColumn>
                    <telerik:GridBoundColumn  DataField="PurchaseShortDate" UniqueName="PurchaseDate"  ReadOnly="true" HeaderText="Ngày nhập">
                        <HeaderStyle HorizontalAlign="Center"  Width="100px" />
                        <ItemStyle HorizontalAlign="Center" />
                    </telerik:GridBoundColumn>
                      <telerik:GridBoundColumn  DataField="StatusName" UniqueName="StatusName"  ReadOnly="true" HeaderText="Tình trạng">
                        <HeaderStyle HorizontalAlign="Center" Width="100px" />
                        <ItemStyle HorizontalAlign="Center" /></telerik:GridBoundColumn>
                    <telerik:GridTemplateColumn HeaderText="Chi tiết" HeaderButtonType="TextButton" ItemStyle-HorizontalAlign="Center">
                        <ItemTemplate>
                            <asp:Button ID="Button1" CssClass="btnViewDetail" CommandArgument='<%# Eval("PurchaseOrderID") %>'
                                CommandName="EditItem" runat="server"></asp:Button>
                        </ItemTemplate>
                        <HeaderStyle HorizontalAlign="Center" Width="50px" />
                        <ItemStyle HorizontalAlign="Center" ></ItemStyle>
                    </telerik:GridTemplateColumn>
                    <%--<telerik:GridTemplateColumn HeaderText="Xóa" Visible=true HeaderButtonType="TextButton" ItemStyle-HorizontalAlign="Center">
                        <ItemTemplate>
                            <asp:Button ID="Button2" CssClass="btnX" CommandArgument='<%# Eval("PurchaseOrderID") %>'
                                OnClientClick="return ConfirmOnDelete('Bạn chắc chắn muốn xóa không?')" CommandName="DeleteItem"
                                runat="server"></asp:Button>
                        </ItemTemplate>
                        <HeaderStyle Width="30px"/>
                            <ItemStyle HorizontalAlign="Center" />
                    </telerik:GridTemplateColumn>--%>
                </Columns>
                </MasterTableView>
            </telerik:radgrid>
        </div>
            <!--End Grid data-->
    </telerik:RadPageView>
    <!--End Tab Tim kiem -->
             </telerik:RadMultiPage>
            
           
<div style="clear:both"></div>
</ContentTemplate>
    <Triggers>
<asp:PostBackTrigger ControlID="btnImport" />
<asp:PostBackTrigger ControlID="gvProduct" />
</Triggers>
</asp:UpdatePanel>

<div class="progressbar">
    <asp:UpdateProgress ID="up" runat="server" AssociatedUpdatePanelID="UpdatePanel1">
        <ProgressTemplate>
            <div class="bg">
                <div class="progress progress-striped active">
                    <div class="progress-bar" role="progressbar" aria-valuenow="45" aria-valuemin="0"
                        aria-valuemax="100" style="width: 100%">
                        <span class="sr-only">100% Complete</span>
                    </div>
                </div>
            </div>
        </ProgressTemplate>
    </asp:UpdateProgress>
</div>

<script type="text/javascript">
    function OnClientClose(oWnd, args) {

    }
    function FormatNumber(obj) {

        var x;

        if (eval(obj))

            x = eval(obj).value;

        else

            x = obj;

        var num = x.replace(/$|,/g, '');

        if (isNaN(num)) { num = ""; }

        sign = (num == (num = Math.abs(num)));

        num = Math.floor(num * 100 + 0.50000000001);

        num = Math.floor(num / 100).toString();

        for (var i = 0; i < Math.floor((num.length - (1 + i)) / 3); i++) {

            num = num.substring(0, num.length - (4 * i + 3)) + ',' + num.substring(num.length - (4 * i + 3));

        }

        eval(obj).value = num;

    } 
</script>
